package com.gitee.neuray.security.gateway.strategy;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author: zhhongyu
 * @description: 接口白名单配置
 * @since: Create in 11:04 2020/3/27
 */
@Component
public class InterfaceWhiteListStrategy {
    @Value("${gate.ignore.startWith}")
    private String startWith;

    /**
     * URI是否以什么打头
     *
     * @param requestUri
     * @return
     */
    public boolean isStartWith(String requestUri) {
        boolean flag = false;
        for (String s : startWith.split(",")) {
            if (requestUri.startsWith(s)) {
                return true;
            }
        }
        return flag;
    }
}
